home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Testing & Debugging / Virtual User tools / SPEC S&L v.1.0.1 / Scripts / PageMaker.vu < prev    next >
Encoding:
Text File  |  1993-12-17  |  7.9 KB  |  221 lines  |  [TEXT/MPS ]

  1. #
  2. # ****************************************************************************
  3. #
  4. #    File Name:        PageMaker.vu
  5. #
  6. #    Contains:    Quick look test script for Pagemaker version 4.2
  7. #
  8. #    Written by:    Kevin Avoy, Ken Landreth, Michael Leong, Gil Spencer et al
  9. #
  10. #    Copyright:    © 1993 by Apple Computer, Inc., all rights reserved.
  11. #
  12. # ****************************************************************************
  13. #            C h a n g e        H i s t o r y (most recent first):
  14. # ****************************************************************************
  15. #
  16. #        Vers      Date        Author        Description
  17. #        ----    --------    ------    ---------------------------------------------
  18. #     <1.0.6>     9/30/93    KTA        Initialize gFileName prior to gApptitle being updated by
  19. #                                    launchTwitch().
  20. #     <1.0.5>     9/28/93    KTA        Added returnVal for ModifyDocument hook.
  21. #     <1.0.2>     6/16/93    NAGA        Renaming InitGlobals(ScriptLevel)to InitGlobals(ScriptLevel)
  22. #        <1+>     5/25/93    NAGA        Adding header and porting old files to follow new standards
  23. #
  24. # ****************************************************************************
  25. #
  26.  
  27.  
  28.  
  29. ########################################################################
  30. #                            External libraries 
  31. #=======================================================================
  32. Libraries "Output.Lib", "DoTasks.Lib","Draw.Lib","UserInterface.Lib","DA.Lib", "Font.Lib", "Globals.Lib", "LaunchQuit.Lib", "TCS.Lib";
  33.  
  34.  
  35. #########################################################################
  36. ########               Application Specific Tasks
  37. #########################################################################
  38.  
  39. #########################################################################
  40. #                        InitAppGlobals()
  41. #========================================================================
  42. # Author:        KA
  43. # Description:    Sets up tools and fonts for Pagemaker.  This task
  44. #                must be called first.
  45. # Parameters:    None
  46. # Returns:        Nothing
  47. # Examples:        InitAppGlobals()
  48. #========================================================================
  49. # History:
  50. #
  51. ########################################################################
  52. task InitAppGlobals()
  53. begin
  54.     
  55.     logstr("setting up {global gApptitle}'s globals");            
  56.     global kClick, kDrag, kDragClick, kMultiDrag, kMultiClickDrag, kMultiClick;
  57.     global kPalDocWind, kPalWind, kPullOffPal, kPopUpPal, kScrollPal;
  58.     global kToolPaletteNum := 1; 
  59.     global kLinePaletteNum := 0;
  60.     global kPatternPaletteNum := 0;
  61.     global kColorPaletteNum := 0;
  62.  
  63.     global gLineWeights := {};# This is used for menuItems
  64.                         
  65.     global gWindowInset := {20,40,20,20};        # Window inset
  66.     global gScreenInset := {0,20,0,0};            # Screen inset
  67.     global gVoidRect := {};        # Rect not to draw in - coordinates should be RelativeToWindow
  68.     global gTextStr;
  69.     global gDocumentWindow := 0;    # only used in Freehand at this point;
  70.     
  71.     global gPaletteList :=    {
  72.                             {                        #### Start Palette #1 - Tools
  73.                             {'Toolbox',18},            # List := {Specifier for Palette window ("String" if TITLE, integer if ORD), Header height}.
  74.                             kPalWind,                # Palette type
  75.                             {4,2},                    # Size of Tool matrix {numElemsWide,numElemsTall}
  76.                             {30,20}                    # Offset between tools {h,v}
  77.                             }                        #### End Palette #1
  78.     };
  79.     
  80.     
  81.     ### PageMaker                                                                    {Flag, Pattern, Line, Color}
  82.     ### Palette Elements:=        Tool#, Pal#,     ToolName,     ToolType,    DblClktoEnd        SetAttributes
  83.     global PointerTool         :=     { 1,     1,        "Pointer",        kClick,         0,                 {0}};
  84.     global LineTool            :=     { 2,     1,        "Line",         kDrag,        0,                 {0}};
  85.     global StraightLine        :=     { 3,     1,        "StraightLine",    kDrag,         0,                 {0}};
  86.     global CharTool            :=     { 4,      1,        "Character",    kClick,        0,                 {gTextStr}};
  87.  
  88.     global RectTool             :=     { 5,     1,        "Rect",            kDrag,        1,                 {0}};
  89.     global RndRectTool         :=     { 6,      1,        "RndRect",        kDrag,        0,                 {0}};
  90.     global OvalTool             :=     { 7,      1,        "Oval",            kDrag,        0,                 {0}};
  91.     global CropTool         :=     { 8,      1,        "Crop",            kDrag,         0,                 {0}};
  92.  
  93.  
  94.  
  95.     # global Tool list
  96.     global gToolList:={    PointerTool, 
  97.                         LineTool,
  98.                         StraightLine,
  99.                         CharTool,
  100.                         
  101.                         RectTool,
  102.                         RndRectTool,
  103.                         OvalTool,
  104.                         CropTool                    
  105.     };
  106.     
  107.             ### font characteristic lists
  108.     global gFontSizeList := {'6','8','9','10','11','12','14','18', '24','30','36','48','60','72'};
  109.     #global gFontSizeList := {'6','8','9','10','11','12','14','18', '24'};
  110.     global gFontStyleList := {"Bold","Italic","Underline","Strikethru","Outline","Shadow"};
  111.     
  112.         ### Name of the Plain (style) menu item  ####
  113.     global gPlainStyle := "Normal";            # Plain-Style menu item
  114.  
  115.         ### How to get to the next line
  116.     global gNextLineMethod := 1;            
  117.         ### 1 - ReturnKey,  2 - EnterKey, 3 - DownArrow Key, 4 - TabKey, {} - Move/Click, {'Untitled'} - Move relative to the window titled 'Untitled' /Click
  118.     
  119.         ### Does moving to the next line clear all font info
  120.     global gNextLineClearsFontSettings := 0;                        
  121.  
  122. end;    #InitAppGlobals
  123.  
  124. #########################################################################
  125. #                            PageMakerModifyDocument()
  126. #========================================================================
  127. # Author:        ML
  128. # Description:    Modify Canvas Document
  129. # Parameters:    None
  130. # Returns:        Nothing
  131. # Examples:        PageMakerModifyDocument();
  132. # Assumptions:    None 
  133. # Applications:    PageMaker
  134. #========================================================================
  135. # History:
  136. #
  137. #########################################################################
  138. task PageMakerModifyDocument()
  139. begin
  140.     return(Scrapbook(global kScrapTEXT));
  141. end;
  142.  
  143. #########################################################################
  144. #                        DoDrawPageMaker()
  145. #========================================================================
  146. # Author:        KTA
  147. # Description:    Test draw in Pagemaker. 
  148. # Parameters:    None
  149. # Returns:        Nada
  150. # Examples:        DoDrawPageMaker();
  151. # Assumptions:    PageMaker
  152. #========================================================================
  153. # History:
  154. #
  155. #########################################################################
  156. task DoDrawPageMaker()
  157. begin
  158.     #Set up a Void Rect so that we don't draw on the ToolBox
  159.     ToolWindow := FindWindow('ToolBox');
  160.     TheRect := ToolWindow.r;
  161.     global gVoidRect := TheRect;
  162.     DoDraw();
  163. end;
  164.  
  165. #########################################################################
  166. #                        DoTextPageMaker()
  167. #========================================================================
  168. # Author:        KTA
  169. # Description:    Test text in Pagemaker. 
  170. # Parameters:    None
  171. # Returns:        Nada
  172. # Examples:        DoTextPageMaker();
  173. # Assumptions:    PageMaker
  174. #========================================================================
  175. # History:
  176. #
  177. #########################################################################
  178. task DoTextPageMaker()
  179. begin
  180. Global gWindowInset;
  181.     SetTool(global CharTool); 
  182.     MoveRelativeToWindow(175,65,,2);
  183.     wait(3);
  184.     DoText(); 
  185.     SpecialKey(EnterKey, "EnterKey");
  186. end;
  187.  
  188. ################################################################################
  189. ####################             Main script                    ####################
  190. ################################################################################
  191. script PageMaker (ScriptLevel:= -1)
  192. begin
  193.     InitGlobals(ScriptLevel);            # initialize your general globals
  194.     InitDraw();
  195.     InitFonts();
  196.     Global gApptitle := "PageMaker";
  197.     global gAppVersion := '4';        # version of app you will be running
  198.     global gFileName := "@!@-{gBuildVers}-{gAppTitle}";    # This is used in SaveAs when saving files
  199.     SuiteStart('PageMaker.vu');                    # begin a new test suite
  200.     if LaunchTwitch("{gAppTitle}",gAliasDirectory) # launch or twitch to your app
  201.     begin
  202.         global gModifyDocument:= task PageMakerModifyDocument; # define app specific task
  203.         InitAppGlobals();                                    # init app specific globals
  204.         (*
  205.         *)
  206.         DoSetUpApp(,-1,,"OK",1,1,1);    # No Default window
  207.         DoDrawPageMaker();
  208.         DoTextPageMaker();         
  209.         DoWindow();                
  210.         DoCloseApp(1);         
  211.     end; # if LaunchTwitch("{gAppTitle}",gAliasDirectory)
  212.     SuiteEnd();
  213. end; # script PageMaker
  214.  
  215. ### What's Needed
  216. # 1) Insure that Palette is up and in the left corner or the screen
  217. # 2) Insure that Pointer tool is selected after DoText before DoWindow 
  218. # 4) Possibly close the toolbox before starting Window tests.
  219. # 5) Typing below the document window creates an error dialog
  220.  
  221.